package com.medi.chats.config;

import com.medi.chats.utils.MyConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 描述:
 * 自定义配置
 *
 * @outhor Administrator
 * @create 2018-11-05 11:27
 */
@Configuration
public class MyWebAppConfigurer implements WebMvcConfigurer {
    @Autowired
    MyConfig myConfig;

    /**
     * @Description  资源映射路径
     * @Author        Administrator
     * @Date          2018/11/5 11:31
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/filepath/**").addResourceLocations("file:///" + myConfig.getUploadPath());
//        registry.addResourceHandler("/filepath/**").addResourceLocations("file:///"+myConfig.getUploadpath());
    }
}
